<?php

class XController {
	public $name, $action, $model=array(), $cache, $params, $registry;
	
	public function __construct ($model) {
		$this->model = $model;
	}
	
	public function getModel () {
		return $this->model;
	}
	
	public function getCache () {
		return $this->cache;
	}
	
	public function getParams () {
		return $this->params;
	}
	
	public function getRegistry () {
		return $this->registry;
	}
	
	public function Error404 () {
		XT::$registry->http->setHeader('HTTP/1.0 404 Not Found');
	}
	
	public function runAction () {
		$action=$this->action;
		if(method_exists($this, $action))
			return $this->$action();
		else return $this->Error404();
	}
}